/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.velocityme.entity;

import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

/**
 *
 * @author rcrida
 */
@Entity
@NamedQueries( {
    @NamedQuery(name="findAllStates",
                query="SELECT o FROM State o WHERE o.deleted = FALSE"),
    @NamedQuery(name="findStartState",
                query="SELECT o FROM State o WHERE o.name = 'Start State'")
})
public class State extends Node {
    private static final long serialVersionUID = 1L;

    private boolean active;

    @OneToMany(mappedBy = "sourceState")
    private Collection<Transition> transitions;

    public State() {
    }

    public State(Node parentNode, String name, String description, boolean active) {
        super(parentNode, name, description);
        this.active = active;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

}
